]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st: Remove deprecated cogl_texture_new()
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Sun, 11 Nov 2018 00:41:28 +0000 (22:41 -0200)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Mon, 12 Nov 2018 23:59:36 +0000 (21:59 -0200)
cogl_texture_new() is used in a few places in GNOME Shell, but
it's a deprecated Cogl function. The replacement is the less
verbose cogl_texture_2d_new_with_size(), that is very much a
straightforward replacement.

Remove the few places where this function is used, replacing
it by the CoglTexture2d counterpart.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/287

src/st/st-private.c
src/st/st-scroll-view-fade.c
src/st/st-theme-node-drawing.c
src/st/st-theme-node-transition.c

index 512fbba4564e3d21015d62e30ea92fdf5351b8dc..1068a74ee9524128baa8385808adab14c3c46329 100644 (file)
@@ -455,14 +455,13 @@ _st_create_shadow_pipeline_from_actor (StShadow     *shadow_spec,
       CoglTexture *buffer;
       CoglOffscreen *offscreen;
       CoglFramebuffer *fb;
+      CoglContext *ctx;
       CoglColor clear_color;
       CoglError *catch_error = NULL;
       float x, y;
 
-      buffer = cogl_texture_new_with_size (width,
-                                           height,
-                                           COGL_TEXTURE_NO_SLICING,
-                                           COGL_PIXEL_FORMAT_ANY);
+      ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
+      buffer = cogl_texture_2d_new_with_size (ctx, width, height);
 
       if (buffer == NULL)
         return NULL;
index 1753afaa5dcea5da2bbf47886783c097dd902a18..8282ddc5b7f2b4786a370ca38d4eefe294bfef74 100644 (file)
@@ -66,10 +66,10 @@ st_scroll_view_fade_create_texture (ClutterOffscreenEffect *effect,
                                     gfloat                  min_width,
                                     gfloat                  min_height)
 {
-  return cogl_texture_new_with_size (min_width,
-                                     min_height,
-                                     COGL_TEXTURE_NO_SLICING,
-                                     COGL_PIXEL_FORMAT_RGBA_8888_PRE);
+  CoglContext *ctx =
+    clutter_backend_get_cogl_context (clutter_get_default_backend ());
+
+  return cogl_texture_2d_new_with_size (ctx, min_width, min_height);
 }
 
 static char *
index 2123cc4872805c0c28c46c0ef54dbfc435351d41..f59065aefb9a4c025c6e92f6e11001272958cc6a 100644 (file)
@@ -2220,12 +2220,15 @@ static void
 st_theme_node_prerender_shadow (StThemeNodePaintState *state)
 {
   StThemeNode *node = state->node;
+  CoglContext *ctx;
   guint border_radius[4];
   int max_borders[4];
   int center_radius, corner_id;
   CoglHandle buffer, offscreen = COGL_INVALID_HANDLE;
   CoglError *error = NULL;
 
+  ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
+
   /* Get infos from the node */
   if (state->alloc_width < node->box_shadow_min_width ||
       state->alloc_height < node->box_shadow_min_height)
@@ -2261,10 +2264,9 @@ st_theme_node_prerender_shadow (StThemeNodePaintState *state)
     }
 
   /* Render offscreen */
-  buffer = cogl_texture_new_with_size (state->box_shadow_width,
-                                       state->box_shadow_height,
-                                       COGL_TEXTURE_NO_SLICING,
-                                       COGL_PIXEL_FORMAT_ANY);
+  buffer = cogl_texture_2d_new_with_size (ctx,
+                                          state->box_shadow_width,
+                                          state->box_shadow_height);
   if (buffer == NULL)
     return;
 
index afde977693985300ca62890baa19771d439e266e..608c49cabf95607488cdc14b727e3056e9210be1 100644 (file)
@@ -240,12 +240,14 @@ setup_framebuffers (StThemeNodeTransition *transition,
                     const ClutterActorBox *allocation)
 {
   StThemeNodeTransitionPrivate *priv = transition->priv;
+  CoglContext *ctx;
   guint width, height;
   CoglError *catch_error = NULL;
 
   /* template material to avoid unnecessary shader compilation */
   static CoglHandle material_template = COGL_INVALID_HANDLE;
 
+  ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
   width  = priv->offscreen_box.x2 - priv->offscreen_box.x1;
   height = priv->offscreen_box.y2 - priv->offscreen_box.y1;
 
@@ -254,15 +256,11 @@ setup_framebuffers (StThemeNodeTransition *transition,
 
   if (priv->old_texture)
     cogl_handle_unref (priv->old_texture);
-  priv->old_texture = cogl_texture_new_with_size (width, height,
-                                                  COGL_TEXTURE_NO_SLICING,
-                                                  COGL_PIXEL_FORMAT_ANY);
+  priv->old_texture = cogl_texture_2d_new_with_size (ctx, width, height);
 
   if (priv->new_texture)
     cogl_handle_unref (priv->new_texture);
-  priv->new_texture = cogl_texture_new_with_size (width, height,
-                                                  COGL_TEXTURE_NO_SLICING,
-                                                  COGL_PIXEL_FORMAT_ANY);
+  priv->new_texture = cogl_texture_2d_new_with_size (ctx, width, height);
 
   if (priv->old_texture == COGL_INVALID_HANDLE)
     return FALSE;